<template>
	<view class="my_search_container" :style="{'background-color': bgcolor}" @click="searchClick">
		<view class="my_search_box" :style="{'border-radius': borderRadius + 'px'}">
			<uni-icons type="search" size="18"></uni-icons>
			<text class="my_search_text">搜索</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "search",
		props:{
			bgcolor:{
				type:String,
				default:'#C00000'
			},
			borderRadius:{
				type:Number,
				default: 18
			}
			
		},
		data() {
			return {

			};
		},
		methods: {
			// 点击搜索框
			searchClick() {
				this.$emit('searchClickFn')
			}
		}
	}
</script>

<style lang="scss">
	.my_search_container {
		// 设置定位效果为“吸顶”
		position: sticky;
		// 吸顶的“位置”
		top: 0;
		// 提高层级，防止被轮播图覆盖
		z-index: 9;
		display: flex;
		justify-content: center;
		align-items: center;
		height: 50px;
		// background-color: #c00000;
		padding: 0 10px;

		.my_search_box {
			display: flex;
			justify-content: center;
			align-items: center;
			height: 36px;
			width: 100%;
			// border-radius: 18px;
			background-color: #ffffff;

			.my_search_text {
				margin-left: 6px;
			}
		}

	}
</style>